export default {
    inserted: function(el, binding) {
        const { callback, time } = binding.value;
        el.callback = callback;
        el.time = time;
        el.addEventListener("click", () => {
            const nowTime = new Date().getTime();
            if (!el.preTime || nowTime - el.preTime > el.time) {
                el.preTime = nowTime;
                el.callback();
            }
        });
    },
    update: function(el, binding) {
        console.log("update");
        const { callback, time } = binding.value;
        el.callback = callback;
        el.time = time;
    },
};
